package com.bwie.system.controller;

import com.bwie.common.domain.Attraction;
import com.bwie.common.domain.UserAttraction;
import com.bwie.common.domain.request.AttractionReq;
import com.bwie.common.domain.response.AttractionResp;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import com.bwie.system.service.AttractionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @className: AttractionController
 * @Description: TODO
 * @version: v1.８.0
 * @author:
 * @date:
 */
@RestController
public class AttractionController {
    @Autowired
    private AttractionService attractionService;

    /**
     * 景区预约首页
     * @param attractionReq
     * @return
     */
    @PostMapping("/attractionList")
    public PageResult<AttractionResp> attractionList(@RequestBody AttractionReq attractionReq){
        return attractionService.attractionList(attractionReq);
    }

    @GetMapping("/toAdd")
    public Result toAdd(){
        attractionService.toAdd();
        return Result.success();
    }
    /**
     * 门票预约
     * @param userAttraction
     * @return
     */
    @PostMapping("/addUserAttraction")
    public Result addUserAttraction(@RequestBody UserAttraction userAttraction){
        attractionService.addUserAttraction(userAttraction);
        return Result.success();
    }

    /**
     * 退票
     * @param userAttraction
     * @return
     */
    @PostMapping("/deleteRecord")
    public Result deleteRecord(@RequestBody UserAttraction userAttraction) throws InterruptedException {
        attractionService.deleteRecord(userAttraction);
        return Result.success();
    }


}
